<div class="page-header">
    <h1>
        公会操作日志
        <small>
            <i class="ace-icon fa fa-angle-double-right"></i>
        </small>
    </h1>
</div>
<div class="row">
    <div class="col-xs-12">
        <table id="dtpList" class="dataTable">
        </table>
        <div id="dtpList_filter" class="dataTables_filter">
            <div>
                <select id="dtpList_F_SType" class="selectpicker" data-style="btn btn-info btn-sm" data-width="90px">
                    <option value="">模糊查询</option>
                    <option data-divider="true"></option>
                    <option value="Log_ID">日志ID</option>
                    <option value="User_ID">用户ID</option>
                    <option value="NickName">用户昵称</option>
                    <option value="RealName">真实姓名</option>
                    <option value="Family_ID">公会ID</option>
                    <option value="Family_Name">公会名称</option>
                </select>
                <input id="dtpList_F_SValue" class="fvalue" type="text"/>
                <label>操作时间</label>
                <input id="dtpList_F_StartDate" type="text" style="width: 76px;" placeholder="开始时间">
                <label>-</label>
                <input id="dtpList_F_EndDate" type="text" style="width: 76px;" placeholder="结束时间">
                <select id="dtpList_F_SelectDate"></select>
                <button id="dtpList_F_Btn"></button>
            </div>
        </div>
    </div>
</div>
<script src="<%- Virtual_Path.Static %>jquery.plugin/dataTables/jquery.dataTables.min.js"></script>
<script src="<%- Virtual_Path.Static %>jquery.plugin/dataTables/jquery.dataTables.bootstrap.min.js"></script>
<script>
    $(function () {
        //region 时间输入框插件
        $('#dtpList_F_StartDate, #dtpList_F_EndDate').datetimepicker({
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            minView: 2,
            autoclose: true
        });
        //endregion
        //region 绑定日期选择框
        $.KOC.Date.Select.Bind({
            eSelect: $('#dtpList_F_SelectDate'),
            eBegin: $('#dtpList_F_StartDate'),
            eEnd: $('#dtpList_F_EndDate')
        });
        //endregion
        //region dtpList
        var _dtpList = $("#dtpList").dataTable({
            'aoColumns': [
                {
                    'sWidth': '90px', 'data': 'Log_ID', 'sName': 'Log_ID', 'sTitle': '日志ID', 'sClass': 'center',
                    'createdCell': function (td, cellData) {
                        $(td).text(cellData);
                    }
                },
                {
                    'sWidth': '90px', 'data': 'User_ID', 'sName': 'User_ID', 'sTitle': '用户ID', 'sClass': 'center',
                    'createdCell': function (td, cellData) {
                        $(td).html($('<a/>').attr('data-openwindow', ':UserInfo:' + cellData).text(cellData));
                    }
                },
                {
                    'data': 'NickName', 'sName': 'User_ID', 'sTitle': '昵称', 'sClass': 'center t-left',
                    'createdCell': function (td, cellData, rowData) {
                        $(td).html('<span class="Level_User_' + rowData.Level + '"></span>' + cellData);
                    }
                },
                {
                    'sWidth': '100px', 'data': 'Family_ID', 'sName': 'Family_ID', 'sTitle': '公会ID', 'sClass': 'center',
                    'createdCell': function (td, cellData) {
                        $(td).html($('<a/>').attr('data-openwindow', ':UserInfo:' + cellData).text(cellData));
                    }
                },
                {
                    'sWidth': '15%', 'data': 'Family_Name', 'sName': 'Family_ID', 'sTitle': '公会名称', 'sClass': 'center t-left',
                    'createdCell': function (td, cellData) {
                        $(td).text(cellData);
                    }
                },
                {
                    'sWidth': '8%', 'data': 'Function_Code', 'sTitle': '操作代码', 'sClass': 'center', 'bSortable': false
                },
                {
                    'sWidth': '8%', 'data': 'Operation', 'sTitle': '操作内容', 'sClass': 'center', 'bSortable': false
                },
                {
                    'sWidth': '90px', 'data': 'Related_ID', 'sTitle': '渠道ID', 'sClass': 'center', 'bSortable': false
                },
                {
                    'sWidth': '10%', 'data': 'Related_URL', 'sTitle': 'URL', 'sClass': 'center', 'bSortable': false
                },
                {
                    'sWidth': '110px', 'data': 'Create_Date', 'sName': 'Log_ID', 'sTitle': '操作日期', 'sClass': 'center',
                    'createdCell': function (td, cellData) {
                        $(td).text(moment(cellData).format('YY/MM/DD HH:mm'));
                    }
                }
            ],
            'aaSorting': [0, 'desc'],
            'sAjaxSource': '/ajax/log.page.familyoperation',
            'fnServerParams': function (aoData) {
                if (!this.arrPageFilter) {
                    this.arrPageFilter = {
                        F_StartDate: $(this.selector + '_F_StartDate').val(),
                        F_EndDate: $(this.selector + '_F_EndDate').val()
                    };
                } else {
                    $(this.selector + '_F_StartDate').val(this.arrPageFilter.F_StartDate);
                    $(this.selector + '_F_EndDate').val(this.arrPageFilter.F_EndDate);
                }
                this.ofnServerParams(aoData);
            },
            'fnDrawCallback': function () {
                $.Common.Bootstrap.Tooltip(this);
                this.ofnDrawCallback();
            },
            'selectOpt': {}
        });
        //endregion
    });
</script>